﻿///////////////////////////////////////////////////////////////
// This is generated code. 
//////////////////////////////////////////////////////////////
// Code is generated using LLBLGen Pro version: 2.6
// Code is generated on: 2011年7月5日 11:37:43
// Code is generated using templates: SD.TemplateBindings.SharedTemplates.NET20
// Templates vendor: Solutions Design.
// Templates version: 
//////////////////////////////////////////////////////////////
using System;
using System.Collections;
using System.Collections.Generic;
using CARMSData;
using CARMSData.FactoryClasses;
using CARMSData.HelperClasses;
using SD.LLBLGen.Pro.ORMSupportClasses;

namespace CARMSData.RelationClasses
{
	/// <summary>Implements the static Relations variant for the entity: ReportHeader. </summary>
	public partial class ReportHeaderRelations
	{
		/// <summary>CTor</summary>
		public ReportHeaderRelations()
		{
		}

		/// <summary>Gets all relations of the ReportHeaderEntity as a list of IEntityRelation objects.</summary>
		/// <returns>a list of IEntityRelation objects</returns>
		public virtual List<IEntityRelation> GetAllRelations()
		{
			List<IEntityRelation> toReturn = new List<IEntityRelation>();
			toReturn.Add(this.MessageEntityUsingReportHeaderId);
			toReturn.Add(this.ReportValueEntityUsingReportHeaderId);

			toReturn.Add(this.ReportCategoryEntityUsingReportCategoryId);
			toReturn.Add(this.ReportFlowEntityUsingReportFlowId);
			toReturn.Add(this.UserEntityUsingApplyUserId);
			return toReturn;
		}

		#region Class Property Declarations

		/// <summary>Returns a new IEntityRelation object, between ReportHeaderEntity and MessageEntity over the 1:n relation they have, using the relation between the fields:
		/// ReportHeader.ReportHeaderId - Message.ReportHeaderId
		/// </summary>
		public virtual IEntityRelation MessageEntityUsingReportHeaderId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "Message" , true);
				relation.AddEntityFieldPair(ReportHeaderFields.ReportHeaderId, MessageFields.ReportHeaderId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportHeaderEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("MessageEntity", false);
				return relation;
			}
		}

		/// <summary>Returns a new IEntityRelation object, between ReportHeaderEntity and ReportValueEntity over the 1:n relation they have, using the relation between the fields:
		/// ReportHeader.ReportHeaderId - ReportValue.ReportHeaderId
		/// </summary>
		public virtual IEntityRelation ReportValueEntityUsingReportHeaderId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.OneToMany, "ReportValue" , true);
				relation.AddEntityFieldPair(ReportHeaderFields.ReportHeaderId, ReportValueFields.ReportHeaderId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportHeaderEntity", true);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportValueEntity", false);
				return relation;
			}
		}


		/// <summary>Returns a new IEntityRelation object, between ReportHeaderEntity and ReportCategoryEntity over the m:1 relation they have, using the relation between the fields:
		/// ReportHeader.ReportCategoryId - ReportCategory.ReportCategoryId
		/// </summary>
		public virtual IEntityRelation ReportCategoryEntityUsingReportCategoryId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "ReportCategory", false);
				relation.AddEntityFieldPair(ReportCategoryFields.ReportCategoryId, ReportHeaderFields.ReportCategoryId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportCategoryEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportHeaderEntity", true);
				return relation;
			}
		}
		/// <summary>Returns a new IEntityRelation object, between ReportHeaderEntity and ReportFlowEntity over the m:1 relation they have, using the relation between the fields:
		/// ReportHeader.ReportFlowId - ReportFlow.ReportFlowId
		/// </summary>
		public virtual IEntityRelation ReportFlowEntityUsingReportFlowId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "ReportFlow", false);
				relation.AddEntityFieldPair(ReportFlowFields.ReportFlowId, ReportHeaderFields.ReportFlowId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportFlowEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportHeaderEntity", true);
				return relation;
			}
		}
		/// <summary>Returns a new IEntityRelation object, between ReportHeaderEntity and UserEntity over the m:1 relation they have, using the relation between the fields:
		/// ReportHeader.ApplyUserId - User.UserId
		/// </summary>
		public virtual IEntityRelation UserEntityUsingApplyUserId
		{
			get
			{
				IEntityRelation relation = new EntityRelation(SD.LLBLGen.Pro.ORMSupportClasses.RelationType.ManyToOne, "User", false);
				relation.AddEntityFieldPair(UserFields.UserId, ReportHeaderFields.ApplyUserId);
				relation.InheritanceInfoPkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("UserEntity", false);
				relation.InheritanceInfoFkSideEntity = InheritanceInfoProviderSingleton.GetInstance().GetInheritanceInfo("ReportHeaderEntity", true);
				return relation;
			}
		}

		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSubTypeRelation(string subTypeEntityName) { return null; }
		/// <summary>stub, not used in this entity, only for TargetPerEntity entities.</summary>
		public virtual IEntityRelation GetSuperTypeRelation() { return null;}

		#endregion

		#region Included Code

		#endregion
	}
}
